﻿using System;

using System.Collections.Generic;
using System.Text;
using Silvermoon.Controls.Classes;
using Silvermoon.Shapes;
using System.Drawing;
using Silvermoon.Interfaces;
using Silvermoon.Windows;
using Silvermoon.Controls.Base;
using Silvermoon.Controls.Interfaces;

namespace Silvermoon.Controls
{
    /// <summary>
    /// Control that contains collections of controls.f
    /// See also <seealso cref="T:ScrollPanel"/>.
    /// </summary>
    public class Panel : CompositeControlBase, ICompositeControl, IColor
    {
        private bool canFocus = true;

        public ControlCollection Controls { get { return GetVisibleControls(); } }

        #region Methods

        protected override Shape CreateDefaultBackground()
        {
            return new RectangleShape { Color = Color.Empty };
        }

        public override bool CanFocus
        {
            get
            {
                return canFocus ? base.CanFocus : false;
            }
        }

        public bool IsFocusable
        {
            get { return canFocus; }
            set { canFocus = value; }
        }

        protected override void OnChildVisibleChanged(Control child)
        {
            base.OnChildVisibleChanged(child);
            Invalidate(InvalidationFlag.Layout);
        }

        #endregion

    }
}
